#include <bits/stdc++.h>
using namespace std;
class Mutex;
void lock(Mutex *pm){
    cout << "lock it" << endl;
};   // lock mutex pointed to by pm
void unlock(Mutex *pm){
    cout << "unlock it" << endl;
}; // unlock the mutex
class Lock
{
public:
    explicit Lock(Mutex *pm) : mutexPtr(pm, unlock)
    {
        lock(mutexPtr.get());
    }

private:
    std::shared_ptr<Mutex> mutexPtr;
};

class Mutex{
    public:
        void print() { cout << "mutex called" << endl; };
};

int main()
{
    Mutex m;
    Lock ml1(&m);
    Lock ml2(ml1);
}
